package br.edu.ufcg.greengrid.model.job.scheduler;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import br.edu.ufcg.greengrid.model.job.Job;
import br.edu.ufcg.greengrid.model.machine.Machine;

import com.mallardsoft.tuple.Pair;
import com.mallardsoft.tuple.Tuple;

public class DummyJobScheduler implements JobScheduler {

	@Override
	public List<Pair<Machine, Job>> schedule(List<Machine> machines, List<Job> jobs) {

		machines = orderMachines(machines);
		
		List<Pair<Machine, Job>> allocations = new LinkedList<Pair<Machine, Job>>();
		
		Iterator<Machine> mIter = machines.iterator();
		Iterator<Job> jIter = jobs.iterator();
		
		while (mIter.hasNext() && jIter.hasNext()) {
			Machine machine = mIter.next();
			Job job = jIter.next();
			allocations.add(Tuple.from(machine, job));
		}
		
		return allocations;
	}
	
	protected List<Machine> orderMachines(List<Machine> machines){
		
		return machines;
	}

}
